home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1995 April / Internet Tools.iso / x25 / nrs.shar.Z / nrs.shar / makefile.SH < prev    next >
Encoding:
Makefile  |  1990-04-27  |  15.5 KB  |  512 lines

  1. case $CONFIG in
  2.     '') . config.sh ;;
  3. esac
  4. outputfile=makefile
  5. rm -f $outputfile.$$
  6. echo "Creating $outputfile (with variable substitutions)"
  7. if cat >$outputfile.$$ <<!GROK!THIS!
  8. # RCSid[] = "@(#)$Header: makefile.SH,v 3.6 88/09/08 17:41:09 pb Exp $"
  9. # $Log:    makefile.SH,v $
  10. # Revision 3.6  88/09/08  17:41:09  pb
  11. # Distribution of VME: VME + new level for errors + speed up + misc tidies
  12. # Revision 3.5  88/05/27  06:30:33  pb
  13. # Distribution of EdText: Edtext + check .cf args + triple to file num + make to temp files
  14. # Revision 3.4  87/10/13  18:22:22  pb
  15. # Distribution of NullStringsNotZero: Always retrun a valid - maybe null - string.
  16. # Revision 3.3  87/05/16  06:21:01  pb
  17. # fix wdbm stuff and smail
  18. # Revision 3.1  87/02/03  08:50:50  pb
  19. # Distribution of VmsAppRelayFix: Omit entries for VMS if application relay + DBM+PRIME formats
  20. RCSsymbNAME=VME
  21. RCSmessage =VME + new level for errors + speed up + misc tidies
  22.  
  23. # Copyright 1986, Piete Brooks, Julian Onions & Adrian Pell
  24. #      pb@cl.cam.ac.uk, jpo@hcig.nott.ac.uk, Adrian.R.Pell@reading.ac.uk
  25. #
  26. # This program may be copied as long as you don't remove this notice,
  27. # try to make any money off of it, or pretend that you wrote it.
  28.  
  29. # ANY MODS TO THIE FILE WILL BE DESTROYED.
  30. # It is made automatically from makefile.SH
  31.  
  32. # The next four items are zapped by makefile.SH
  33. DATADIR    = $datadir
  34. WDBM    = $wdbm
  35. AWK    = $awkf
  36. DIRSAMP = $dirsample            # a test to see if new derfil1
  37. SMAILNAME=$smailname            # the hostname for smail awk
  38.  
  39. # May be over-ridden on the make command line (make SHAR=wombat ...)
  40. MAKE    = make
  41. SHAR    = shar
  42. SHAROPTS= #-c -v -p X
  43.  
  44. #- The options are:
  45. #-    help        generate list of arguments for make
  46. #-    configure    start the ball rolling .....
  47. #-
  48. #-    nrs (default)    make the nrs program
  49. #-    atomic        fetch the NRS atomic files
  50. #-
  51. #-    york        generate york [ york dir compacted ]
  52. #-    inst-york    install the york directory
  53. #-    york21        generate york21 (D2.1) [ single service entry ]
  54. #-    inst-york21    install the york directory (D2.1)
  55. #-    x25hosts    generate x25hosts
  56. #-    mmdf        generate files as specified in mmdf.cf
  57. #-    t.central    generate text format like t.central
  58. #-    vms5        generate vms format 5 files (new)
  59. #-    vms4        generate vms format 4 files (old)
  60. #-    sendmail    generate files as specified in sendmail.cf
  61. #-    smail        generate Reading smail tables
  62. #-    dbm1        generate dbm1 format files
  63. #-    prime        generate prime format files
  64. #-    edtext        generate a more readable text format (default format)
  65. #-    simpleedtext    generate a more readable text format (simple format)
  66. #-    shortedtext    generate a more readable text format (short format)
  67. #-    longedtext    generate a more readable text format (long format)
  68. #-    bothedtext    generate a more readable text format (l and s format)
  69. #-    pp        generate pp format files (dmn, chan & top)
  70. #-
  71. #-    nrs.txt        generate nroff version of nrs documentation
  72. #-    SPD.txt        generate printable version of SPD
  73. #-    tags        generate tags
  74. #-    lint        pass the sources through lint (!!)
  75. #-    neat        remove generated files other than .o
  76. #-    tidy, clean    remove all generated files (except nrs)
  77. #-    clobber        remove all generated files (EVEN nrs)
  78. #-
  79. #-    tardist        generate master nrs.tar
  80. #-    shardist    generate master nrs.shar
  81. #-    primedist    generate prime distribution
  82. #-    unixdist    generate unix distribution
  83. #-    vmsdist        generate vms distribution
  84. #-
  85. #-    co        check out all files
  86. #-    ci        check in all files (CIFLAGS=-r3.2)
  87.  
  88. .SUFFIXES: .VMS .SH
  89.  
  90. # The object files
  91. OBJS    = \\
  92.     config.o \\
  93.     defs.o     \\
  94.     lru.o     \\
  95.     main.o     \\
  96.     misc.o     \\
  97.     output.o
  98.  
  99. SRCS    = \\
  100.     config.c \\
  101.     defs.c     \\
  102.     lru.c     \\
  103.     main.c     \\
  104.     misc.c     \\
  105.     output.c
  106.  
  107. LOCALISE= config.sh
  108. LOCALS    = makefile.SH Makefile \$(LOCALISE)
  109. HFILES  = nrs.h
  110. SHFILES    = central simple.awk smail.awk
  111. # These are remade by Configure
  112. FILESH    = makefile.SH nrs.SH getfiles.SH \\
  113.       mmdf.SH york.SH ryork.SH central.SH x25hosts.SH text.SH \\
  114.       vms4.SH vms5.SH smail.SH sendmail.SH york21.SH ryork21.SH dbm1.SH \\
  115.       prime.SH edtext.SH pp.SH
  116. FILES    = nrs.h getfiles \\
  117.       mmdf.cf york.cf ryork.cf central.cf x25hosts.cf text.cf \\
  118.       vms4.cf vms5.cf smail.cf sendmail.cf york21.cf ryork21.cf dbm1.cf \\
  119.       prime.cf edtext.cf pp.cf
  120. FILEVMS    = nrs.VMS mmdf.VMS york.VMS ryork.VMS central.VMS x25hosts.VMS \\
  121.       text.VMS vms4.VMS vms5.VMS smail.VMS sendmail.VMS york21.VMS \\
  122.       ryork21.VMS dbm1.VMS prime.VMS edtext.VMS pp.VMS
  123. DOCSRCS    = nrs.1 nrs.5 nrs.ms README SPD.ms
  124. DOCS    = \$(DOCSRCS) nrs.txt SPD.txt
  125. SRCDIST    = \$(SRCS) hdr.file vms4hdr.file vms5hdr.file
  126. BASEDIST= \$(SRCDIST) \$(DOCSRCS)
  127. PRIMEDIST=PRIME.LST \$(BASEDIST) make.cpl decompress.c nrs.hPRIME
  128. UNIXDIST= UNIX.LST Configure Makefile \$(BASEDIST) \$(FILESH) \$(SHFILES) wdbm.c
  129. VMSDIST = VMS.LST \$(BASEDIST) make.com stdconf.com $(FILEVMS)
  130. DIST    = FULL.LST \$(SRCDIST) \$(DOCS) \\
  131.       make.cpl decompress.c nrs.hPRIME \\
  132.       Configure Makefile \$(FILESH) \$(SHFILES) wdbm.c \\
  133.       make.com vms.com.ed stdconf.com
  134. RCS    = \$(DOCSRCS) \$(SRCS) hdr.file vms4hdr.file vms5hdr.file \\
  135.       make.cpl decompress.c nrs.hPRIME \\
  136.       Configure Makefile \$(FILESH) \$(SHFILES) wdbm.c \\
  137.       make.com vms.com.ed stdconf.com \$(FILEVMS)
  138. DIREC    = /usr/lib/x25/directory    # the york directory
  139. DIRECDBM= /usr/lib/x25/directory.pag # the york dbm directory
  140. LDFLAGS = -s
  141. CFLAGS  = -O
  142. LFLAGS    = -haxbc
  143. COFLAGS = -q
  144. CIFLAGS    = -k    # or -r3.2
  145.  
  146. #    Rules for building nrs
  147. #################################################################
  148. #################################################################
  149.  
  150. initial: \$(LOCALISE) nrs
  151.  
  152. nrs    : \$(OBJS)
  153.     \$(CC) \$(LDFLAGS) -o \$@ \$(OBJS)
  154.  
  155. \$(OBJS) : \$(HFILES)
  156.  
  157. #    Rules for zapping the directories
  158. #################################################################
  159. #################################################################
  160.  
  161. FULL.LST: makefile
  162.     echo \$(DIST) | tr ' ' '\012' | sort -u > FULL.LST
  163.  
  164. UNIX.LST: makefile
  165.     echo \$(UNIXDIST) | tr ' ' '\012' | sort -u > UNIX.LST
  166.  
  167. VMS.LST: makefile
  168.     echo \$(VMSDIST) | tr ' ' '\012' | sort -u > VMS.LST
  169.  
  170. PRIME.LST: makefile
  171.     echo \$(PRIMEDIST) | tr ' ' '\012' | sort -u > PRIME.LST
  172.  
  173. \$(FILES):
  174.     $(MAKE) $(MFLAGS) configure
  175.  
  176. \$(LOCALISE): Configure makefile
  177.     $(MAKE) $(MFLAGS) configure
  178.     touch \$(LOCALISE)
  179.  
  180. configure:    Configure UNIX.LST $(FILESH)
  181.     sh Configure quick
  182.  
  183.  
  184. #    Rules for fetching the NRS files to \$(DATADIR)/new
  185. #################################################################
  186. #################################################################
  187.  
  188. atomic:    \$(DATADIR)/new/\$(DIRSAMP)
  189.  
  190. \$(DATADIR)/new/\$(DIRSAMP): \$(LOCALS) getfiles
  191.     -@$(MAKE) $(MFLAGS) \$(DATADIR)/new
  192.     sh getfiles
  193.  
  194. \$(DATADIR)/new:
  195.     mkdir \$(DATADIR)/new
  196.  
  197. #    Rules for building raw (D2.2) york directory
  198. #################################################################
  199. #################################################################
  200.  
  201. york.raw:    york.cf \$(DATADIR)/\$(DIRSAMP) hdr.file
  202.     nrs york.cf > york.raw
  203.  
  204. ryork.raw:    ryork.cf \$(DATADIR)/\$(DIRSAMP) hdr.file
  205.     nrs ryork.cf 'output reverse' > ryork.raw
  206.  
  207. york.extra:
  208.     @echo You must provide a file of extra local entries e.g. NEWS entries
  209.     @echo Put them in \$@
  210.     @false
  211.  
  212. inst-york:    \$(DIRECDBM)
  213.  
  214. \$(DIRECDBM): \$(DIREC)
  215.     \$(WDBM)
  216.  
  217. \$(DIREC):    york
  218.     cp york \$(DIREC)
  219.  
  220. #    sort york.raw ryork.raw (NRS) & york.extra (local)  > york.sort
  221. #    merge lines of york.sort                > york.simple
  222. #    Now prefix comments and any other local additions   > york
  223. #
  224. #################################################################
  225. #################################################################
  226.  
  227. york:    york.simple york.raw ryork.raw york.extra
  228.     cat york.raw ryork.raw york.extra | grep \\^# > york
  229.     -if [ -r york.local ] ;       then cat york.local   >> york; fi
  230.                     cat york.simple  >> york
  231.     -if [ -r york.aliases ] ;  then cat york.aliases >> york; fi
  232.  
  233. \$(WDBM) wdbm: wdbm.c
  234.     cc wdbm.c -o wdbm -lx25
  235.     mv wdbm \$(WDBM)
  236.  
  237. york.sort:    york.raw ryork.raw york.extra
  238.     sort -t\\: york.raw ryork.raw york.extra +1 -2 +3 | \\
  239.         grep -v \\^# > york.sort
  240.  
  241. york.simple:    york.sort simple.awk
  242.     \$(AWK) simple.awk < york.sort > york.simple
  243.  
  244. #    YUCK YUCK Rules for building old format (D2.1) york directory
  245. #
  246. #################################################################
  247. #################################################################
  248.  
  249. york21.raw:    york21.cf \$(DATADIR)/\$(DIRSAMP) hdr.file
  250.     nrs york21.cf > york21.raw
  251.  
  252. ryork21.raw:    ryork21.cf \$(DATADIR)/\$(DIRSAMP) hdr.file
  253.     nrs ryork21.cf 'output reverse' > ryork21.raw
  254.  
  255. york21.extra:
  256.     @echo You must provide a file of extra local entries e.g. NEWS entries
  257.     @echo Put them in \$@
  258.     @false
  259.  
  260. york21: york21.raw ryork21.raw york21.extra
  261.     cat /dev/null > york21
  262.     -if [ -r york21.local ] ;   then cat york21.local   >> york21; fi
  263.     cat york21.raw ryork21.raw york21.extra            >> york21
  264.     -if [ -r york21.aliases ] ; then cat york21.aliases >> york21; fi
  265.  
  266. inst-york21: york21
  267.     cp york21 \$(DIREC)
  268.  
  269. #    Rules for building x25hosts
  270. #################################################################
  271. #################################################################
  272.  
  273. x25hosts:    x25hosts.cf \$(DATADIR)/\$(DIRSAMP) hdr.file
  274.     nrs \$@.cf > TMP.\$@
  275.     mv TMP.\$@ \$@
  276.  
  277. #    Rules for building mmdf tables + domains
  278. #################################################################
  279. #################################################################
  280.  
  281. mmdf:    mmdf.cf \$(DATADIR)/\$(DIRSAMP) hdr.file
  282.     nrs \$@.cf
  283.  
  284. #    Rules for building vms4 tables
  285. #################################################################
  286. #################################################################
  287.  
  288. vms4:    vms4.cf \$(DATADIR)/\$(DIRSAMP) vms4hdr.file
  289.     nrs \$@.cf > TMP.\$@
  290.     mv TMP.\$@ \$@
  291.  
  292. #    Rules for building vms5 tables
  293. #################################################################
  294. #################################################################
  295.  
  296. vms5:    vms5.cf \$(DATADIR)/\$(DIRSAMP) vms5hdr.file
  297.     nrs \$@.cf > TMP.\$@
  298.     mv TMP.\$@ \$@
  299.  
  300. #    Rules for building sendmail UK tables
  301. #################################################################
  302. #################################################################
  303.  
  304. sendmail:    sendmail.cf \$(DATADIR)/\$(DIRSAMP) hdr.file
  305.     nrs \$@.cf > TMP.\$@
  306.     mv TMP.\$@ \$@
  307.  
  308. #    Rules for building Reading sendmail tables
  309. #################################################################
  310. #################################################################
  311.  
  312. smail:    smail.cf \$(DATADIR)/\$(DIRSAMP) hdr.file
  313.     echo '#sep space' > TMP.\$@
  314.     -if [ -r \$@..local ] ; then cat \$@..local >> TMP.\$@; fi
  315.     nrs \$@.cf >> TMP.\$@
  316.     echo '#hostname $(SMAILNAME)' | cat - TMP.\$@ | \
  317.      \$(AWK) \$@..awk>\$@..aliases
  318.     mv TMP.\$@ \$@
  319.  
  320. #    Rules for building t.central format
  321. #################################################################
  322. #################################################################
  323.  
  324. t.central: central central.cf \$(DATADIR)/\$(DIRSAMP)
  325.     central > TMP.\$@
  326.     mv TMP.\$@ \$@
  327.  
  328. #    Rules for building dbm1 format
  329. #################################################################
  330. #################################################################
  331.  
  332. dbm1:    dbm1.cf \$(DATADIR)/\$(DIRSAMP) hdr.file
  333.     nrs \$@.cf > TMP.\$@
  334.     nrs \$@.cf "output reverse" >> TMP.\$@
  335.     mv TMP.\$@ \$@
  336.  
  337. #    Rules for building prime format
  338. #################################################################
  339. #################################################################
  340.  
  341. prime:    prime.cf \$(DATADIR)/\$(DIRSAMP) hdr.file
  342.     nrs \$@.cf > TMP.\$@
  343.     mv TMP.\$@ \$@
  344.  
  345. #    Rules for building prime format
  346. #################################################################
  347. #################################################################
  348.  
  349. edtext shortedtext:    edtext.cf \$(DATADIR)/\$(DIRSAMP) hdr.file
  350.     nrs \$@.cf > TMP.\$@
  351.     mv TMP.\$@ \$@
  352. longedtext:    edtext.cf \$(DATADIR)/\$(DIRSAMP) hdr.file
  353.     nrs \$@.cf > TMP.\$@ "output edtext long"
  354.     mv TMP.\$@ \$@
  355. bothedtext:    edtext.cf \$(DATADIR)/\$(DIRSAMP) hdr.file
  356.     nrs \$@.cf > TMP.\$@ "output edtext short long"
  357.     mv TMP.\$@ \$@
  358. simpleedtext:    edtext.cf \$(DATADIR)/\$(DIRSAMP) hdr.file
  359.     nrs \$@.cf > TMP.\$@ "output edtext simple"
  360.     mv TMP.\$@ \$@
  361.  
  362. #    Rules for building pp format
  363. #################################################################
  364. #################################################################
  365.  
  366. pp:    pp.cf \$(DATADIR)/\$(DIRSAMP) hdr.file
  367.     nrs \$@.cf
  368.  
  369. #    Rules for making text version of SPD.ms
  370. #################################################################
  371. #################################################################
  372.  
  373. SPD.txt:    SPD.ms
  374.     nroff -ms SPD.ms > TMP.\$@
  375.     mv TMP.\$@ \$@
  376.  
  377. #    Rules for making text version of nrs.ms
  378. #################################################################
  379. #################################################################
  380.  
  381. nrs.txt:    nrs.ms
  382.     nroff -ms nrs.ms > TMP.\$@
  383.     mv TMP.\$@ \$@
  384.  
  385. #    Miscellaneous tasks
  386. #################################################################
  387. #################################################################
  388.  
  389. help    : makefile
  390.     @sed -e '/^#-/s/#-//p' -e d makefile
  391.  
  392. tags    : \$(SRCS) \$(HFILES)
  393.     ctags -t \$(SRCS) \$(HFILES)
  394.  
  395. lint    : \$(SRCS) \$(HFILES)
  396.     lint \$(LFLAGS) \$(SRCS)
  397.  
  398. tardist : nrs.tar
  399. nrs.tar    : \$(DIST)
  400.     tar cvf nrs.tar \$(DIST)
  401.  
  402. shardist: nrs.shar
  403. nrs.shar    : \$(DIST) FULL.LST
  404.     \$(SHAR) \$(SHAROPTS) \`cat FULL.LST\` > nrs.shar
  405.  
  406.  
  407. primedist: nrs.comi
  408. nrs.comi: \$(PRIMEDIST) PRIME.LST
  409.     ( echo 'como -ntty /* switch off command output */'; \\
  410.       echo '/* Now start the loop ......*/'; \\
  411.       for file in \`cat PRIME.LST\`; \\
  412.       do echo 'ed /* get good old ed */'; \\
  413.          echo ''; \\
  414.          echo '   brief'; \\
  415.          echo '   mode nosemi'; \\
  416.          echo '   symbol esc '; \\
  417.          echo '   symbol tab '; \\
  418.          echo '   erase '; \\
  419.          echo '   kill '; \\
  420.          echo ''; \\
  421.          sed 's/^/X/' < \$\$file; \\
  422.          echo ''; \\
  423.          echo '   top'; \\
  424.          echo '   change/X//32767'; \\
  425.          echo '   file' \`echo \$\$file | sed s/.c\$\$/.cc/\`; \\
  426.          echo ''; \\
  427.       done; \\
  428.       echo '/* Thats is the loop done....tidy up*/'; \\
  429.       echo 'como -tty /* switch command output back on */'; \\
  430.       echo ''; \\
  431.       echo 'comi -end /* finish up the command input file */'\\
  432.     ) > nrs.comi
  433.  
  434. $(FILEVMS): vms.com.ed
  435. .SH.VMS:
  436.     cat \$*.SH > \$*.VMS
  437.     ed - \$*.VMS < vms.com.ed
  438.  
  439. vmsdist: nrs.com
  440. nrs.com    : \$(VMSDIST) VMS.LST
  441.     for file in \`cat VMS.LST\`; \\
  442.     do echo '\$\$ WRITE SYS\$\$OUTPUT "    Creating' \$\$file'"'; \\
  443.        echo '\$\$ CREATE' \$\$file; \\
  444.        echo '\$\$ DECKS/DOLLARS="XXXXX-EOF-XXXXX"'; \\
  445.        grep '' \$\$file; \\
  446.        echo 'XXXXX-EOF-XXXXX'; \\
  447.     done > nrs.com
  448.  
  449.  
  450. unixdist: nrs-shar
  451. nrs-shar    : \$(UNIXDIST) UNIX.LST
  452.     \$(SHAR) \$(SHAROPTS) \`cat UNIX.LST\` > nrs-shar
  453.  
  454. co    : ALWAYS
  455.     co \$(COFLAGS) \$(RCS)
  456.  
  457. ci    : ALWAYS
  458.     @echo ci -m\\"Distribution of \$(RCSsymbNAME): \$(RCSmessage)\\"\\
  459.      \$(CIFLAGS) -N\\"\$(RCSsymbNAME)\\" \$(RCS) ... well almost ...
  460.     @for target in \$(RCS) ; do \\
  461.       rc=true; \\
  462.       if [ -r "\$\$target" ]; \\
  463.       then    if co -p -q "\$\$target" | cmp -s - "\$\$target"; \\
  464.         then     rm -f "\$\$target"; \\
  465.         else    rcs -l "\$\$target"; \\
  466.             ci -m"Distribution of \$(RCSsymbNAME): \$(RCSmessage)" \$(CIFLAGS) -N"\$(RCSsymbNAME)" "\$\$target"; \\
  467.             rc=false; \\
  468.         fi; \\
  469.       fi; \\
  470.       if \$\$rc; \\
  471.       then    eval \`rlog -h \$\$target | awk '{ if (\$\$1 == "head:") print "vers=\\"" \$\$2 "\\""}'\`; \\
  472.         rcs -N\$(RCSsymbNAME):\$\$vers -sRel "\$\$target"; \\
  473.       fi; \\
  474.     done
  475.  
  476. tidy    : clean
  477. clean    : neat
  478.     rm -f \$(OBJS)
  479.  
  480. neat    :
  481.     rm -f core a.out nrs.sh nrs.tar .emacs* *.CKP TMP.* \\
  482.         *-dmn *.map *.pag *.dir *.dat *-chan \\
  483.         york york.raw ryork.raw york.sort york.simple \\
  484.         york.old york.sort.old york.simple.old \\
  485.         york21 york21.raw ryork21.raw york21.sort york21.simple \\
  486.         york21.old york21.sort.old york21.simple.old \\
  487.         vms sendmail smail t.central nrs.txt x25hosts
  488.  
  489. clobber: clean
  490.     rm -f nrs *.cf
  491.  
  492. ALWAYS:
  493. !GROK!THIS!
  494. then if cmp $outputfile $outputfile.$$ > /dev/null 2>& 1
  495.     then
  496.         rm -f $outputfile.$$
  497.         echo "    " $outputfile not affected
  498.     elif mv $outputfile.$$ $outputfile
  499.     then
  500.         echo "    " $outputfile updated
  501.     else
  502.         echo "+++    " $outputfile left in $outputfile.$$
  503.     fi
  504. else
  505.     echo "    " Failed to create $outputfile.$$
  506. fi
  507.